<%-- 
    Document   : terms
    Created on : May 4, 2012, 11:50:02 AM
    Author     : Jayson Kiong
--%>

<%@page import="java.text.DecimalFormat"%>
<%@page import="Model.Terms"%>
<%@page import="java.util.ArrayList"%>
<%@page import="Model.Types"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="Pragma" content="no-cache">
        <meta http-equiv="Cache-Control" content="no-cache">
        <meta http-equiv="Expires" content="Sat, 01 Dec 2001 00:00:00 GMT">
        <link rel = "stylesheet" type = "text/css" href = "quicklendstyle.css"/>
        <link rel="stylesheet" type="text/css" href="css/jquery.datepick.css" id="theme">
        <link type="text/css" href="css/ui-lightness/jquery-ui-1.8.19.custom.css" rel="stylesheet" />
	<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
	<script type="text/javascript" src="js/jquery-ui-1.8.19.custom.min.js"></script>
        <script src="gen_validatorv4.js" type="text/javascript"></script>
        <script type="text/javascript" src="js/jquery.datepick.js"></script>
        <script type="text/javascript" src="quicklendjs.js"></script>
        
        <script type="text/javascript">
            $(function(){
             $('#termtodate').datepick();
             $('#termfromdate').datepick();
              });
        </script>
        <title>Terms</title>
    </head>
    <body>
        <%ArrayList ar = (ArrayList)session.getAttribute("types");
          ArrayList termar = (ArrayList)session.getAttribute("termlist");
          DecimalFormat df = new DecimalFormat("0.00");
          int arctr=0;
          Types type = new Types();
          Terms term = new Terms();
          int arsize = ar.size();
          int termarsize = termar.size();
          
        %>
      
        <div id="head" style="position:absolute;top:12px;left:25px; font-family:segoe ui;font-size:20px;color:#EBBD05;font-weight:600">
            Terms
        </div>
        
        <div id="typetable" style="position:absolute; top:50px; left:25px; font-family: segoe ui; font-size:11px;overflow: auto; width: 800px; height:190px; padding:0px; margin: 0px; ">
                        <table border="1" cellspacing=0 cellpadding=2 style="height:60px">
                        
                        <tr>
                            <th width=250 bgcolor="lightgrey">Terms</th>
                            <th width=250 bgcolor="lightgrey">Client Type</th>
                            <th width=250 bgcolor="lightgrey">Loan Type</th>
                            <th width=250 bgcolor="lightgrey">Sub Type</th>
                            <th width=250 bgcolor="lightgrey">Less UI%</th>
                            <th width=230 bgcolor="lightgrey">Service Charge%</th>
                            <th width=230 bgcolor="lightgrey">Notary Fee</th>
                            <th width=250 bgcolor="lightgrey">E-VAT%</th>
                            <th width=250 bgcolor="lightgrey">Doc Stamps%</th>
                            <th width=250 bgcolor="lightgrey">Collection Fee</th>
                            <th width=250 bgcolor="lightgrey">Processing Fee</th>
                            <th width=250 bgcolor="lightgrey">Bank Charge</th>
                            <th width=250 bgcolor="lightgrey">LBC Charge</th>
                            <th width=250 bgcolor="lightgrey">Cash Bound</th>
                            <th width=250 bgcolor="lightgrey">Commission</th>
                            <th width=250 bgcolor="lightgrey">Function</th>
                        </tr>
                         <%arctr=0;
                        
                          for(int x=0;x<termarsize;x++){
                          term=(Terms)termar.get(arctr); %>
                          <tr><td style="display:none"><%=term.getiTermid()%></td><td><%=term.getStrTerm()%></td><td><%=term.getStrClienttype()%></td><td><%=term.getStrLoantype()%></td><td><%=term.getStrSubtype()%></td><td><%=term.getfLessui()%></td><td><%=term.getfServicecharge()%></td><td><%=df.format(term.getfNotaryfee())%></td><td><%=term.getfEvat()%></td><td><%=term.getfDocs()%></td><td><%=term.getfCollectionfee()%></td><td><%=df.format(term.getfProcessingfee())%></td><td><%=df.format(term.getfBankcharge())%></td><td><%=df.format(term.getfLbccharge())%></td><td><%=df.format(term.getfCashbound())%></td><td><%=term.getfCommission()%></td><td><input type="button" name="edit" value="Edit" style="background-color:#49743D;font-weight:bold;color:#ffffff;" onclick="editTerm(<%=term.getiTermid()%>)"></td></tr> 
                          <%arctr++;}%>
                        
                        </table>
        </div>

        <form  method="POST" id="termsform"> 
        <div id="createnewterm" style="position:absolute; top:250px;left:30px">
            <div id="borrowertitle">
                Create New Term
                
            </div>
            </br>
            <table id="tablecontent" style="filter:alpha(opacity=100)">
                <tr>
                    <td>Client Type:</td><td><select name="clienttype" style="width:130px;">
                                             <%arctr=0;
                                             for(int x=0;x<arsize;x++){
                                             type=(Types)ar.get(arctr); 
                                             if(type.getStrType().equals("Client")){
                                             %>
                                             <option value="<%=type.getStrName()%>"><%=type.getStrName()%></option>
                                             <%}%>   
                                             <%arctr++;}%> 
                                             </select></td>
                    <td>Sub Type:</td><td><select name="subtype" style="width:130px;">
                                             <%arctr=0;
                                             for(int x=0;x<arsize;x++){
                                             type=(Types)ar.get(arctr); 
                                             if(type.getStrType().equals("Sub")){
                                             %>
                                             <option value="<%=type.getStrName()%>"><%=type.getStrName()%></option>
                                             <%}%>   
                                             <%arctr++;}%> 
                                             </select></td>
                    <td>Loan Type:</td><td><select name="loantype" style="width:130px;">
                                             <%arctr=0;
                                             for(int x=0;x<arsize;x++){
                                             type=(Types)ar.get(arctr); 
                                             if(type.getStrType().equals("Loan")){
                                             %>
                                             <option value="<%=type.getStrName()%>"><%=type.getStrName()%></option>
                                             <%}%>   
                                             <%arctr++;}%> 
                                             </select></td>                         
                    <td>Terms:</td><td><input type="text" style="width:130px;" name="terms"></td>
                </tr>
            </table>
            
            <table id="tablecontent2" style="filder:alpha(opacity=100);font-family:segoe ui; font-size:12px">
                <tr>
                    <td></br><b>Details:</b></td>
                <tr>
                    <td>Interest:</td><td><input type="text" style="width:130px" name="interest"><div id="termsform_interest_errorloc" style="color:#ff0000"></div></td><td></td><td>Collection Fee:</td><td><input type="text" style="width:130px" name="collectionfee"><div id="termsform_collectionfee_errorloc" style="color:#ff0000"></div></td>
                </tr>
                <tr>
                    <td>Service Charge:</td><td><input type="text" style="width:130px" name="servicecharge"><div id="termsform_servicecharge_errorloc" style="color:#ff0000"></div></td><td></td><td>Processing Fee:</td><td><input type="text" style="width:130px" name="processingfee"><div id="termsform_processingfee_errorloc" style="color:#ff0000"></div></td>
                </tr>
                <tr>
                    <td>Notary Fee:</td><td><input type="text" style="width:130px" name="notaryfee"><div id="termsform_notaryfee_errorloc" style="color:#FF0000"></div></td><td></td><td>Bank Charge:</td><td><input type="text" style="width:130px" name="bank"><div id="termsform_bank_errorloc" style="color:#ff0000"></div></td>
                </tr>
                <tr>
                    <td>E-VAT:</td><td><input type="text" style="width:130px"name="evat"><div id="termsform_evat_errorloc" style="color:#FF0000"></div></td><td></td><td>LBC Charge:</td><td><input type="text" style="width:130px" name="lbc"><div id="termsform_lbc_errorloc" style="color:#ff0000"></div></td>
                </tr>
                <tr>
                    <td>Doc Stamps:</td><td><input type="text" style="width:130px" name="docs"><div id="termsform_docs_errorloc" style="color:#FF0000"></div></td><td></td><td>Cashbound:</td><td><input type="text" style="width:130px" name="cashbound"><div id="termsform_cashbound_errorloc" style="color:#ff0000"></div></td>
                </tr>
                <tr>
                    <td>Agent's Commission:</td><td><input type="text" style="width:130px" name="commission"><div id="termsform_commission_errorloc" style="color:#FF0000"></div></td>
                </tr>
            </table>

        </div>
        <div style="position:absolute; top:570px; left:500px;">
            <input action="db.AddTerms.java" type="image" src="images/saveimage.png"  size="17"></a>
            <a href="#" class="termcancelbtn" name="termcancelbtn" size="17"><img src="images/cancelimage.png"></a>
            
        </div>
</form>
         <script type="text/javascript">
         var frmvalidator  = new Validator("termsform");
         frmvalidator.addValidation("interest","req","Please enter amount");
         frmvalidator.addValidation("servicecharge","req","Please enter amount");
         frmvalidator.addValidation("notaryfee","req","Please enter amount");
         frmvalidator.addValidation("evat","req","Please enter amount");
         frmvalidator.addValidation("docs","req","Please enter amount");
         frmvalidator.addValidation("commission","req","Please enter amount");
         frmvalidator.addValidation("collectionfee","req","Please enter amount");
         frmvalidator.addValidation("processingfee","req","Please enter amount");
         frmvalidator.addValidation("bank","req","Please enter amount");
         frmvalidator.addValidation("lbc","req","Please enter amount");
         frmvalidator.addValidation("cashbound","req","Please enter amount");
        
         frmvalidator.EnableOnPageErrorDisplay();
         frmvalidator.EnableMsgsTogether();
    </script>
    </body>
</html>
